function $( id ) {
	return document.getElementById( id );
}
function msg( str ) {
	$( "msg" ).innerHTML = str;
}
function getAttri( obj ) {
	var str = "";
	var attris = new Array();
	for( var a in obj ) {
		attris.push( { "name": a, "value": obj[ a ] } );
	}
	attris.sort( sortByName );
	var len = attris.length;
	var table = $( "attritable" );
	table.style.display = "inline";
	table = table.getElementsByTagName( "tbody" )[ 0 ];
	for( var i = 0; i < len; i++ ) {
		var att = attris.shift();
		var name= att[ "name" ];
		var value= getValue( name, att[ "value" ] );

		var row = table.insertRow( i + 1 );
		var cell = row.insertCell( 0 )
		cell.innerHTML = name;
		cell = row.insertCell( 1 )
		cell.innerHTML = value;
	}
}
function getValue( name, value ) {
	if( name == "innerHTML" || name == "outerHTML" ) {
		return "&lt;HTML&gt;";
	} else
		return value;
}
function sortByName( a, b ) {
	if( a[ "name" ] > b[ "name" ] ) {
		return 1;
	} else if( a[ "name" ] < b[ "name" ] ) {
		return -1;
	} else
		return 0;
}
function getTop( e ){
	var offset = e.offsetTop;
	if( e.offsetParent != null ) offset += getTop( e.offsetParent );
	return offset;
}
function getLeft( e ){
    var offset = e.offsetLeft;
    if( e.offsetParent != null ) offset += getLeft( e.offsetParent );
    return offset;
}